export default function (attrsString) {
  if (!attrsString) return [];
  // 当前是否在引号内
  let isYinhao = false;
  // 断点
  let point = 0;

  // 结果
  let result = [];

  // 遍历attrsString
  for (let i = 0; i < attrsString.length; i++) {
    let char = attrsString[i];
    if (char == '"') {
      // 遇见引号
      isYinhao = !isYinhao;
    } else if (char == ' ' && !isYinhao) {
      // 遇见空格，且不在引号内
      console.log(i);
      if (!/^\s*$/.test(attrsString.substring(point, i))) {
        result.push(attrsString.substring(point, i).trim());
        point = i;
      }
    }
  }

  // 循环结束后，最后还剩一个属性
  result.push(attrsString.substring(point).trim());

  // 映射
  result = result.map(item => {
    // 拆分
    const o = item.match(/^(.+)="(.+)"$/);
    return {
      name: o[1],
      value: o[2]
    }
  })
  return result;
}